# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Daniel Micay <danielmicay@gmail.com>

pkgname=python-scrypt
pkgver=0.8.20
pkgrel=4
pkgdesc='Bindings for the scrypt key derivation function library'
url='https://github.com/holgern/py-scrypt'
arch=('loong64' 'x86_64')
license=('BSD')
depends=('python' 'glibc' 'openssl')
makedepends=('python-setuptools')
source=("${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz")
sha512sums=('2bde277a8f55195743758bf8a4c6054ae8da9a4db977f5562d19b82181a8fc6420d2d5ce6e0c0d22fbb4ceaf63909172979dcf744540cac63a3cf355f99de085')
b2sums=('020d70a7a35c8361f1831b59b67ba2443ab5c075f88348dc0fb3f87e2244162087bddf369be162f421241a9cc3d31ce77db73d553e47f5d3a76f71710d6fa888')

build() {
  cd py-scrypt-${pkgver}
  python setup.py build
}

check() {
  cd py-scrypt-${pkgver}
  local python_version=$(python -c 'import sys; print("".join(map(str, sys.version_info[:2])))')
  PYTHONPATH="$PWD/build/lib.linux-$CARCH-cpython-${python_version}" python -m unittest discover -vs .
}

package() {
  cd py-scrypt-${pkgver}
  python setup.py install --root="${pkgdir}" -O1 --skip-build
  rm -r "${pkgdir}"/usr/lib/python*/site-packages/scrypt/tests
  install -Dm 644 README.rst -t "${pkgdir}/usr/share/doc/${pkgname}"
  install -Dm 644 LICENSE -t "${pkgdir}/usr/share/licenses/${pkgname}"
}

# vim: ts=2 sw=2 et:
